package com.chen.tliaswebtest.controller;

import com.chen.tliaswebtest.pojo.Result;
import com.chen.tliaswebtest.service.DataReportService;
import com.chen.tliaswebtest.service.OperationService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chen
 * @version 1.0
 * @create_date 2025/7/25
 * 数据统计控制器
 */
@RestController
public class DataReportController {
    private final DataReportService dataReportService;
    private final OperationService operationService;

    public DataReportController(DataReportService dataReportService, OperationService operationService) {
        this.dataReportService = dataReportService;
        this.operationService = operationService;
    }

    // 统计员工性别
    @GetMapping("/report/empGenderData")
    public Result getEmpGenderData() {
        return Result.success(dataReportService.getEmpGenderData());
    }

    // 统计各个职位的员工人数
    @GetMapping("/report/empJobData")
    public Result getEmpJobData() {
        return Result.success(dataReportService.getEmpJobData());
    }

    // 统计学员的学历信息
    @GetMapping("/report/studentDegreeData")
    public Result getStudentDegreeData() {
        return Result.success(dataReportService.getStudentDegreeData());
    }

    // 统计每一个班级的人数
    @GetMapping("/report/studentCountData")
    public Result getStudentCountByClazzData() {
        return Result.success(dataReportService.getStudentCountByClazzData());
    }

    // 用于日志信息的分页查询
    @GetMapping("/log/page")
    public Result pageLog(Integer page, Integer pageSize) {
        return Result.success(operationService.pageLog(page, pageSize));
    }

}
